﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CodeAuto.Pages
{
    public partial class ProjectAdd : System.Web.UI.Page
    {
        public bool IsLogin = false;
        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterHyperLink.NavigateUrl = "../Default.aspx";
            if (Session["user"] != null)
            {
                IsLogin = true;
            }
        }

        protected void LoginButton_Click(object sender, EventArgs e)
        {
            if (Session["user"] != null)
            {
                IsLogin = true;
                DavidDB.ADO.DBManager db = new DavidDB.ADO.DBManager();
                Models.T_Project project = new Models.T_Project();
                project.Description = this.TextBox1.Text;
                project.ProjectName = this.UserName.Text;
                db.Insert(project);
                db.Commit();
                db.Dispose();
                Response.Redirect("/Default.aspx");
            }
        }
    }
}